<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>pvsarp</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="pvsanal.html" title="pvsanal" />
    <link rel="next" href="pvsbandp.html" title="pvsbandp" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">pvsarp</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="pvsanal.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="pvsbandp.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="pvsarp"></a>
      <div class="titlepage"></div>
      <a id="Indexpvsarp" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">pvsarp</span>
        </h2>
        <p>pvsarp — 
      Arpeggiate the spectral components of a streaming pv signal.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp137660480"></a>
        <h2>Description</h2>
        <p>
    This opcode arpeggiates spectral components, by amplifying one bin and attenuating
    all the others around it. Used with an LFO it will provide a spectral arpeggiator similar to Trevor Wishart's
    CDP program specarp.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp137661904"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">fsig <span class="command"><strong>pvsarp</strong></span> fsigin, kbin, kdepth, kgain</pre>
      </div>
      <div class="refsect1">
        <a id="idp137664128"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>fsig</em></span> -- output pv stream
    </p>
        <p>
      <span class="emphasis"><em>fsigin</em></span> -- input pv stream
    </p>
        <p>
      <span class="emphasis"><em>kbin</em></span> -- target bin, normalised 0 - 1 (0Hz - Nyquist).
    </p>
        <p>
      <span class="emphasis"><em>kdepth</em></span> -- depth of attenuation of surrounding bins 
    </p>
        <p>
      <span class="emphasis"><em>kgain</em></span> -- gain boost applied to target bin
    </p>
        <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Warning">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Warning]" src="images/warning.png" />
              </td>
              <th align="left">Warning</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        It is unsafe to use the same f-variable for both input and output of pvs opcodes. Using the same one might lead to undefined behavior on some opcodes. Use a different one on the left and right sides of the opcode.
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idp137670224"></a>
        <h2>Examples</h2>
        <p>
        Here is an example of the pvsarp opcode. It uses the file <a class="ulink" href="examples/pvsarp.csd" target="_top"><em class="citetitle">pvsarp.csd</em></a>
        </p>
        <div class="example">
          <a id="idp137671968"></a>
          <p class="title">
            <strong>Example 671. Example of the pvsarp opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     <span class="comment">;;;-d     RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o pvsarp.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 100
<span class="ohdr">nchnls</span> <span class="op">=</span> 1
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

<span class="oblock">instr</span> 1
asig  <span class="opc">in</span>                                 <span class="comment">; get the signal in</span>
idepth <span class="op">=</span> p4

fsig  <span class="opc">pvsanal</span>   asig, 1024, 256, 1024, 1 <span class="comment">; analyse it</span>
kbin  <span class="opc">oscili</span>   0.1, 0.5, 1               <span class="comment">; ftable 1 in the 0-1 range</span>
ftps  <span class="opc">pvsarp</span>   fsig, kbin<span class="op">+</span>0.01, idepth, 2   <span class="comment">; arpeggiate it (range 220.5 - 2425.5)</span>
atps  <span class="opc">pvsynth</span>  ftps                      <span class="comment">; synthesise it</span>

       <span class="opc">out</span> atps
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span> 1 0 4096 10 1 <span class="comment">;sine wave</span>

<span class="stamnt">i</span> 1 0 10 0.9
<span class="stamnt">i</span> 1 + 10 0.5
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
        </p>
        <p>
        Here is another example of the pvsarp opcode. It uses the file <a class="ulink" href="examples/pvsarp2.csd" target="_top"><em class="citetitle">pvsarp2.csd</em></a>
        </p>
        <div class="example">
          <a id="idp137677232"></a>
          <p class="title">
            <strong>Example 672. Example of the pvsarp opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in</span>
-odac    <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o pvsarp2.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 16
<span class="ohdr">nchnls</span> <span class="op">=</span> 1
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

<span class="comment">;; example written by joachim heintz 2009</span>

<span class="oblock">instr</span> 1
ifftsize	<span class="op">=</span>		1024
ioverlap	<span class="op">=</span>		ifftsize <span class="op">/</span> 4
iwinsize	<span class="op">=</span>		ifftsize
iwinshape	<span class="op">=</span>		1<span class="comment">; von-Hann window</span>
Sfile1		<span class="op">=</span>		"fox.wav"
ain1		<span class="opc">soundin</span>	Sfile1
fftin		<span class="opc">pvsanal</span>	ain1, ifftsize, ioverlap, iwinsize, iwinshape
  <span class="comment">;make 3 independently moving accentuations in the spectrum</span>
kbin1		<span class="opc">linseg</span>		0.05, p3<span class="op">/</span>2, .05, p3<span class="op">/</span>2, .05
farp1		<span class="opc">pvsarp</span>		fftin, kbin1, .9, 10
kbin2		<span class="opc">linseg</span>		0.075, p3<span class="op">/</span>2, .1, p3<span class="op">/</span>2, .075
farp2		<span class="opc">pvsarp</span>		fftin, kbin2, .9, 10
kbin3		<span class="opc">linseg</span>		0.02, p3<span class="op">/</span>2, .03, p3<span class="op">/</span>2, .04
farp3		<span class="opc">pvsarp</span>		fftin, kbin3, .9, 10
  <span class="comment">;resynthesize and add them</span>
aout1		<span class="opc">pvsynth</span>	farp1
aout2		<span class="opc">pvsynth</span>	farp2
aout3		<span class="opc">pvsynth</span>	farp3
aout		<span class="op">=</span>		aout1<span class="op">*</span>.3 <span class="op">+</span> aout2<span class="op">*</span>.3 <span class="op">+</span> aout3<span class="op">*</span>.3
		<span class="opc">out</span>		aout
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span> 1 0 3 
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
        </p>
      </div>
      <div class="refsect1">
        <a id="idp137681520"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="pvsanal.html" title="pvsanal"><em class="citetitle">pvsanal</em></a>,
      <a class="link" href="pvsynth.html" title="pvsynth"><em class="citetitle">pvsynth</em></a>,
      <a class="link" href="pvsadsyn.html" title="pvsadsyn"><em class="citetitle">pvsadsyn</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp137685488"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Victor Lazzarini</td>
          </tr>
          <tr>
            <td>April 2005 </td>
          </tr>
        </table>
        <p>
    </p>
        <p>New plugin in version 5</p>
        <p>April 2005.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="pvsanal.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="pvsbandp.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">pvsanal </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> pvsbandp</td>
        </tr>
      </table>
    </div>
  </body>
</html>
